package org.mch.func.file.copyfilelist;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.mch.biz.ui.FuncEvent;
import org.mch.biz.ui.FuncPanel;
import org.mch.swingm.ext.METextChooser;
import org.mch.swingm.obj.MItem;

public class ClientPanel extends FuncPanel {
	private static final long serialVersionUID = 1L;
	private JPanel panel;
	private JButton btn_execute;
	private METextChooser text_copytopath;
	private JScrollPane scrollPane;
	private RSyntaxTextArea text_filename;
	private JPanel panel_1;

	public ClientPanel() {
		initComponents();
	}

	private void initComponents() {
		setLayout(new BorderLayout(0, 0));
		add(getPanel());
	}

	public JPanel getPanel() {
		if (this.panel == null) {
			this.panel = new JPanel();
			panel.setPreferredSize(new Dimension(200, 10));
			panel.setBorder(new LineBorder(Color.LIGHT_GRAY));
			panel.setLayout(new BorderLayout(0, 0));
			panel.add(getScrollPane_1());
			panel.add(getPanel_1(), BorderLayout.NORTH);
		}
		return this.panel;
	}

	protected FuncEvent createEvent() {
		return new ClientEvent(this);
	}

	public JButton getBtn_execute() {
		if (btn_execute == null) {
			btn_execute = new JButton("\u6267\u884C");
			btn_execute.setPreferredSize(new Dimension(100, 23));
			btn_execute.setFont(new Font("宋体", Font.PLAIN, 16));
			btn_execute.setMargin(new Insets(2, 2, 2, 2));
			btn_execute.addActionListener(getEvent());
		}
		return btn_execute;
	}

	public METextChooser getText_copytopath() {
		if (text_copytopath == null) {
			text_copytopath = new METextChooser(new MItem("复制文件目标目录："), METextChooser.SELECT_FOLDER);
		}
		return text_copytopath;
	}

	public JScrollPane getScrollPane_1() {
		if (scrollPane == null) {
			scrollPane = new JScrollPane();
			scrollPane.setBorder(new TitledBorder(null, "\u590D\u5236\u6587\u4EF6\u5217\u8868", TitledBorder.LEADING, TitledBorder.TOP, null, null));
			scrollPane.setViewportView(getText_filename());
		}
		return scrollPane;
	}

	public RSyntaxTextArea getText_filename() {
		if (text_filename == null) {
			text_filename = new RSyntaxTextArea();
			text_filename.setFont(new Font("宋体", Font.PLAIN, 13));
			text_filename.setBorder(new LineBorder(Color.LIGHT_GRAY, 2));
		}
		return text_filename;
	}
	public JPanel getPanel_1() {
		if (panel_1 == null) {
			panel_1 = new JPanel();
			panel_1.setLayout(new BorderLayout(0, 0));
			panel_1.add(getText_copytopath());
			panel_1.add(getBtn_execute(), BorderLayout.EAST);
		}
		return panel_1;
	}
}